<template>
    <div>
        <h1>房态添加</h1>
        <table class="table">
            <tbody>
                <tr>
                    <td>编号</td>  
                    <td>
                        <input type="text" v-model="data.Fid">
                    </td>  
                </tr>

                <tr>
                    <td>房态状态</td>  
                    <td>
                        <select v-model="data.HoumeState">
                            <option value="">请选择</option>
                            <option value="不改变">不改变</option>
                            <option value="设置开房">设置开房</option>
                            <option value="设置关闭">设置关闭</option>
                        </select>
                    </td>  
                </tr>

                <tr>
                    <td>状态</td>  
                    <td>
                        <input type="radio" v-model="data.State" name="state" :value="true">启用
                        <input type="radio" v-model="data.State" name="state" :value="false">禁用
                    </td>  
                </tr>

                <tr>
                    <td></td>  
                    <td>
                        <input type="button" value="添加" @click="adds">
                        <a href="/list">返回</a>
                    </td>  
                </tr>
            </tbody>
        </table>









    </div>
</template>

<script setup lang="ts">
import {ref} from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';

const data=ref({
    "Id": 0,
  "Fid": "",
  "HoumeState": "",
  "State": true,
  "CrateDate": "2025-04-14T01:47:34.441Z"
})

var touer=useRouter();
const adds=()=>{
    if(data.value.Fid==""){
        alert("编号不能为空");
        return;
    }

    axios.post("https://localhost:7267/api/Houme/AddHoum",data.value).then(res=>{
        if(res.data>0){
            alert("添加成功");
            touer.push({path:"/list"});
        }
        else{
            alert("添加失败");
            return;
        }
    })







}




</script>

<style scoped>

</style>